<form nz-form #dictionaryItemCreateOrEditForm="ngForm" (ngSubmit)="save()">
    <div class="modal-header">
        <div class="modal-title">
            <i nz-icon type="share-alt" class="mr-sm"></i>
            <span *ngIf="dictionaryItem.id">{{"Edit" | localize}}: {{dictionaryItem.name}}</span>
            <span *ngIf="!dictionaryItem.id&&!dictionaryItem.parentId">添加数据字典项</span>
            <span *ngIf="dictionaryItem.parentId&&dictionaryItem.parentName">{{'AddSubNodeForXParentNode' | localize:dictionaryItem.parentName}}</span>
        </div>
    </div>

    <fieldset>
        <nz-form-item nz-row>
            <nz-form-label nz-col [nzSm]="4" nzFor="ItemName" nzRequired>
                字典名称
            </nz-form-label>
            <nz-form-control nz-col [nzSm]="20" nzHasFeedback>
                <input nz-input #itemName="ngModel" name="ItemName" [(ngModel)]="dictionaryItem.name"
                    placeholder="请输入字典名称" required maxlength="128">
                <nz-form-explain *ngIf="itemName.dirty && itemName.errors">
                    <validation-messages [formCtrl]="itemName"></validation-messages>
                </nz-form-explain>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item nz-row>
            <nz-form-label nz-col [nzSm]="4" nzFor="ItemCode" nzRequired>
                字典编码
            </nz-form-label>
            <nz-form-control nz-col [nzSm]="20" nzHasFeedback>
                <input nz-input #itemCode="ngModel" name="ItemCode" [(ngModel)]="dictionaryItem.code"
                    placeholder="请输入字典编码" required maxlength="128">
                <nz-form-explain *ngIf="itemCode.dirty && itemCode.errors">
                    <validation-messages [formCtrl]="itemCode"></validation-messages>
                </nz-form-explain>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item nz-row>
            <nz-form-label nz-col [nzSm]="4" nzFor="ItemSortCode" nzRequired>
                排序
            </nz-form-label>
            <nz-form-control nz-col [nzSm]="20" nzHasFeedback>
                <input nz-input #itemSortCode="ngModel" name="ItemSortCode" [(ngModel)]="dictionaryItem.sortCode"
                    placeholder="请输入排序值" required maxlength="128">
                <nz-form-explain *ngIf="itemSortCode.dirty && itemSortCode.errors">
                    <validation-messages [formCtrl]="itemSortCode"></validation-messages>
                </nz-form-explain>
            </nz-form-control>
        </nz-form-item>
    </fieldset>

    <div class="modal-footer">
        <button nz-button [nzType]="'default'" type="button" (click)="close($event)" [disabled]="saving">
            {{"Cancel" | localize}}
        </button>
        <button nz-button [nzType]="'primary'" type="submit" [disabled]="!dictionaryItemCreateOrEditForm.form.valid || saving"
            [nzLoading]="saving">
            <i nz-icon type="save" *ngIf="!saving"></i> {{"Save" | localize}}
        </button>
    </div>

</form>
